using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SapaFinance.Domain.Model;

namespace SapaFinance.Domain.EntityFramework
{
    internal class UserConfiguration : EntityTypeConfiguration<User>
    {
        public UserConfiguration()
        {
            ToTable(typeof (User).Name.ToLower());
            HasKey(x => x.UID);
            Property(x => x.UID).HasColumnName("id").HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(x => x.FullName).HasColumnName("name").IsRequired().IsUnicode();
            Property(x => x.Login).HasColumnName("login").IsRequired().IsUnicode();
        }
    }
}